package com.onpositive.data.serializer.writers;

import com.onpositive.data.IPropertyMetadata;
import com.onpositive.data.IReadableObjectCollection;
import com.onpositive.data.diskstorage.AbstractObjectCollection;
import com.onpositive.data.serializer.readers.MemoryReader;
import com.onpositive.datamap.core.IDataObject;
import com.onpositive.datamap.core.impl.AbstractDataProperty;

public class MemoryObjectCollection extends AbstractObjectCollection  implements IReadableObjectCollection<Integer>{

	public MemoryObjectCollection(int dataSize) {
		super(dataSize);
	}

	@Override
	protected MemoryReader initReader(IPropertyMetadata meta) {
		MemoryReader memoryReader = new MemoryReader(Object.class);
		readerMap.put(meta, memoryReader);
		for (int a=0;a<size();a++){
			memoryReader.append(null);
		}
		return memoryReader;
	}

	
	
	public void setValue(int obj, IPropertyMetadata meta,Object value) {
		MemoryReader reader = (MemoryReader) readerMap.get(meta);

		if (reader == null)
			reader = initReader(meta);
		reader.set(obj, value);
	}

	@Override
	public void setValue(IDataObject obj, AbstractDataProperty p, Object value) {
		
	}

	@Override
	public void updateMeta(IPropertyMetadata mq) {
		
	}
}
